
fn string_equal(s1: &str, s2: &str) -> bool {
    s1 == s2
}

fn string_compare(s1: &str, s2: &str) -> std::cmp::Ordering {
    s1.cmp(s2)
}

fn string_nocase_equal(s1: &str, s2: &str) -> bool {
    string_nocase_compare(s1, s2) == std::cmp::Ordering::Equal
}

fn string_nocase_compare(s1: &str, s2: &str) -> std::cmp::Ordering {
    let s1_bytes = s1.as_bytes();
    let s2_bytes = s2.as_bytes();

    for &b1 in s1_bytes {
        for &b2 in s2_bytes {
            let c1 = b1.to_ascii_lowercase();
            let c2 = b2.to_ascii_lowercase();

            if c1 != c2 {
                return if c1 < c2 {
                    std::cmp::Ordering::Less
                } else {
                    std::cmp::Ordering::Greater
                };
            }
        }
    }

    if s1_bytes.len() == s2_bytes.len() {
        std::cmp::Ordering::Equal
    } else if s1_bytes.len() < s2_bytes.len() {
        std::cmp::Ordering::Less
    } else {
        std::cmp::Ordering::Greater
    }
}

fn main() {
    // Example usage of the functions
    let str1 = "Hello";
    let str2 = "Hello";
    let str3 = "hello";

    println!("string_equal: {}", string_equal(str1, str2)); // true
    println!("string_compare: {:?}", string_compare(str1, str2)); // Equal
    println!("string_nocase_equal: {}", string_nocase_equal(str1, str3)); // true
    println!("string_nocase_compare: {:?}", string_nocase_compare(str1, str3)); // Equal
}

